<?php
if(cmd("lines")){
  $lineCount=0;
  $otherCount=0;
  $moduleCount=0;
  $controlCount=0;
  $disabledCount=0;
  foreach(dirlist("./",true) as $file){
    if(substr($file,strlen($file)-4)==".php"){
      $lineCount+=count(file($file));
      $otherCount++;
    }
  }
  foreach(dirlist("./modules/",true) as $file){
    if(substr($file,strlen($file)-4)==".php"){
      if(substr($file,10,1)!="_"){
        $lineCount+=count(file($file));
      } else {
        $disabledCount++;
      }
      $moduleCount++;
    }
  }
  foreach(dirlist("./controls/",true) as $file){
    if(substr($file,strlen($file)-4)==".php"){
      $lineCount+=count(file($file));
      $controlCount++;
    }
  }
  msg("Lines of PHP code used for $nickname: $lineCount [$moduleCount modules ($disabledCount disabled), $controlCount controls, and $otherCount other]");
}
if(cmd("modules")){
  $moduleList = '';
  $moduleListDis = '';
  foreach(dirlist("./modules") as $file){
    if($file!=".." and substr($file,0,7)!="BACKUP_" and substr($file,0,8)!="_BACKUP_"){
    	$lines = count(file('./modules/' . $file));
    	if(substr($file,strlen($file)-4)!=".php"){
    	} else if(substr($file,0,1)=="_"){
        $moduleListDis.=", ".substr($file,1,strlen($file)-5);
      } else if(substr($file,0,2)=="z_"){
        $moduleList.=", ".substr($file,2,strlen($file)-6)." (LastLoad, $lines lines)";
      } else {
        $moduleList.=", ".substr($file,0,strlen($file)-4) . " ($lines lines)";
      }
    }
  }
  msg('Current modules: ' . trim($moduleList, ', ') . ((strlen($moduleListDis) > 0) ? (' (Disabled: ' . trim($moduleListDis, ', ') . ')') : ''));
}
?>